move on submit form spec to event.py#5638
Conversation
There was a problem hiding this comment.
Greptile Summary
This PR refactors form submission event specifications by moving them from reflex/components/el/elements/forms.py to the central reflex/event.py module. Specifically, it relocates:
- The
FORM_DATAconstant (a JavaScript expression variable) - The
on_submit_event()function that returns form data as a dictionary - The
on_submit_string_event()function that returns form data with string values
These functions were previously defined locally within the forms component file but are now centralized in the event module where all event specifications belong. The moved functions are then imported back into forms.py and added to the EventNamespace class as static methods to maintain API compatibility.
This change improves code organization by consolidating event-related functionality in a single location while maintaining backward compatibility. The Form component continues to use the same event handler types for its on_submit property, but now references the centralized definitions. The refactoring follows the single responsibility principle by placing event specifications in their logical home rather than scattering them across component files.
Confidence score: 5/5
- This is a safe refactoring that moves code without changing functionality
- Proper imports maintain backward compatibility and all references are updated correctly
- The change improves code organization by centralizing event specifications in their appropriate module
- No files need additional attention as the changes are straightforward and well-contained
3 files reviewed, no comments
CodSpeed Performance ReportMerging #5638 will not alter performanceComparing Summary
|
No description provided.